from pymongo import MongoClient, GEOSPHERE
from pymongo import InsertOne
from pymongo.errors import (PyMongoError, BulkWriteError)


MONGO_URI = "mongodb://localhost:27017/spider"

class DataBase:
    client: MongoClient = None

conn: DataBase = DataBase()

async def connect_to_mongo():
    print("连接mongo数据库中...")
    conn.client = MongoClient(MONGO_URI)
    print("连接mongo数据库成功！")


async def close_mongo_connection():
    print("关闭mongo数据库连接...")
    conn.client.close()
    print("mongo数据库连接关闭！")